function logToConsole(message) {
    chrome.extension.getBackgroundPage().console.log(message);
}

function getUrlToShow(details_url) {        
        var res_url = details_url.replace("http://","").replace("https://","").toUpperCase();
        var pos=res_url.search("/");
        if (pos > 0) {
            res_url = res_url.substring(0, pos);
        }
        return res_url;

}

function getMessageToDisplay(details_url) {
        var urlToShow = getUrlToShow(details_url);
        var message = chrome.i18n.getMessage("webResourceIsAffiliatedWithPartyOfRegions", [urlToShow]);
        return message;
}


function showBlockedWarning(details_url, method) {
    try {
        var msg = getMessageToDisplay(details_url);
        if (method == null || method == undefined || "GET" == method.toUpperCase()) {
            alert(msg);
        }
        else {
            logToConsole(msg)
        }
     }
     catch (err) 
     {
        logToConsole(err)
     }
}

